package com.hsogoo.study.spring.propertysource;

import java.util.Map;

import org.junit.Test;
import org.springframework.core.env.MapPropertySource;

import com.google.common.collect.Maps;

/**
 * Created by za-huangsaigang on 2018/9/17.
 */
public class MapPropertySourceTest {

    @Test
    public void testMapPropertySource(){
        Map<String, Object> map = Maps.newHashMap();
        map.put("name", "hsogoo");
        map.put("age", 30);

        MapPropertySource source = new MapPropertySource("person", map);
        System.out.println(source.getProperty("name"));
        System.out.println(source.getProperty("age"));
        for(String s : source.getPropertyNames()){
            System.out.println("property:" + s);
        }
        System.out.println(source.containsProperty("name"));
        System.out.println(source.containsProperty("age"));
        System.out.println(source.getName());
        System.out.println(source.getSource());
    }
}
